define("pages/jls_sj/hsdjform", [
        '../../pages/jls_sj/hsdjform.html.js',
    ],
    function(require){
        var comonts=require("../../common/componts");
        comonts.initSelectPage(undefined);
        comonts.initSelect(undefined,undefined,undefined);

        var _show=function(_jbxx,_jkjc,refresh){

            var tmp= require("../../pages/jls_sj/hsdjform.html");
            var comonts = require("../../common/componts");
            var htmlcompile = template.compile(tmp);
            var html = htmlcompile(
                {
                    jbxx:_jbxx,
                    data:_jkjc
                });
            $("#hsdj").dialog('destroy')  //使用destroy来销毁dialog
            $("#hsdjdialog").html(html);  //取出id为jkjcdialog元素的内容
            $.parser.parse($("#hsdjdialog"));  //动态渲染
            //初始化下拉框
            comonts.initSelectPage(undefined);
            comonts.initSelect(undefined,undefined,undefined);
            var date = new Date();
            var str = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
            var str1 = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
            $("#tbrqfm").datebox("setValue",str1);
            $("#jyrs").window('open');
            $('#tablesss td').find('span').css("border-top","none");
            $('#tablesss td').find('span').css("border-right","none");
            $('#tablesss td').find('span').css("border-left","none");
            console.log(_jbxx)
            //回显
            $('#jcjgfm').textbox("setText",_jbxx.jkzk);
            $('#jcjgfm').textbox("setValue",_jbxx.jkzkString);
            $('#ysyjfm').textbox("setValue",_jbxx.jsly);
            $('#ysfm').textbox("setValue",_jbxx.jcys);
            $('#ysqmrqfm').textbox("setValue",_jbxx.updatetime);
            $('#sldyjfm').textbox("setValue","不同意");
            $('#sldqmfm').textbox("setValue","");
            $('#sldqmrqfm').textbox("setValue",str1);
            $('#bzfm').textbox("setValue","");
            $('#byrsyyfm').textbox("setValue",_jbxx.jsly);
            //设置form表单颜色为灰色
            $('#tbrfm').next().find('input[type=text]').css('color','gray');
            $('#tbrqfm').next().find('input[type=text]').css('color','gray');
            $('#xmfm').next().find('input[type=text]').css('color','gray');
            $('#xbfm').next().find('input[type=text]').css('color','gray');
            $('#csrqfm').next().find('input[type=text]').css('color','gray');
            $('#hjdfm').next().find('input[type=text]').css('color','gray');
            $('#rsrqfm').next().find('input[type=text]').css('color','gray');
            $('#ayfm').next().find('input[type=text]').css('color','gray');
            $('#sydwfm').next().find('input[type=text]').css('color','gray');
            $('#syrfm').next().find('input[type=text]').css('color','gray');
            $('#jcjgfm').next().find('input[type=text]').css('color','gray');
            $('#ysyjfm').next().find('input[type=text]').css('color','gray');
            $('#ysfm').next().find('input[type=text]').css('color','gray');
            $('#ysqmrqfm').next().find('input[type=text]').css('color','gray');
            $('#sldyjfm').next().find('input[type=text]').css('color','gray');
            $('#sldqmfm').next().find('input[type=text]').css('color','gray');
            $('#sldqmrqfm').next().find('input[type=text]').css('color','gray');
            $('#bzfm').next().find('input[type=text]').css('color','gray');
            $('#byrsyyfm').next().find('input[type=text]').css('color','gray');
            $('#table1 td').find('span').css("border-top","none");
            $('#table1 td').find('span').css("border-right","none");
            $('#table1 td').find('span').css("border-left","none");
            $('#table2 td').find('span').css("border-top","none");
            $('#table2 td').find('span').css("border-right","none");
            $('#table2 td').find('span').css("border-left","none");
            $('#table3 td').find('span').css("border-top","none");
            $('#table3 td').find('span').css("border-right","none");
            $('#table3 td').find('span').css("border-left","none");
            /*comboinputEvent();*/
            bindAction(refresh);
        }


        //打印现金接受
        var print = function(ids){
            var labName="kss_xjjsdById";
            var winName = '现金接收表';
            if(ids == undefined || ids==null || ids==""){
                $.messager.alert('提示','无数据打印');
            }else {
                var url=comonts.getReportUrl(true,labName,labName,'id%3d'+ids);
                console.log(url);
                OpenWindow=window.open(url, "现金接收表");
                var content = '<iframe scrolling="auto" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
                OpenWindow.document.write("<TITLE>现金接收表</TITLE>")
                OpenWindow.document.write("<BODY BGCOLOR=#ffffff>")
                OpenWindow.document.write(content)
                OpenWindow.document.write("</BODY>")
                OpenWindow.document.write("</HTML>")
                OpenWindow.document.close()
            }
        }

        //打印暂不收押通知书
        var print_zbsytzs = function(rybh){
            var labName="kss_zbsytzs";
            if(rybh == undefined || rybh==null || rybh==""){
                $.messager.alert('提示','无数据打印');
            }else {
                var comonts = require("../../common/componts");
                var url=comonts.getReportUrl(true,labName,labName,'rybh%3d'+rybh);
                OpenWindow=window.open(url, "暂不收押通知书");
                var content = '<iframe scrolling="auto" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
                OpenWindow.document.write("<TITLE>暂不收押通知书</TITLE>")
                OpenWindow.document.write("<BODY BGCOLOR=#ffffff>")
                OpenWindow.document.write(content)
                OpenWindow.document.write("</BODY>")
                OpenWindow.document.write("</HTML>")
                OpenWindow.document.close()
            }
        }


        var save = function(refresh){
            /*var url = " /kss_xyr/saveZbsy";*/
            var validate=$("#xzry").form('validate');
            if (validate) {
               /* var data =$("#fm").serialize();
                submitLoad();
                $.ajax({
                    type : "POST",  //提交方式
                    url : url,
                    data : data,//数据，这里使用的是Json格式进行传输
                    success : function(result) {
                        if (result.result=='success') {
                            $.messager.alert("确定","保存成功","info");
                            $('#xzry').window('close');
                            refresh();
                        }else{
                            removeLoad();
                            $.messager.alert("确定","保存失败","info");
                        }
                    },
                    complete:function(){
                        removeLoad();
                    },
                });*/
            }else{
                $.messager.alert("提示", '必填项不能为空！');
            }
        }

        var bindAction=function(refresh){
            $("#jyrs_save").on("click",function(){
                save(refresh);
            });
            $("#jbxx_cancel").on("click",function(){
                $("#jyrs").dialog("close");
            });
            $("#ajxx_cancel").on("click",function(){
                $("#jyrs").dialog("close");
            });
            $("#jkjc_cancel").on("click",function(){
                $("#jyrs").dialog("close");
            });
            $("#zplr_cancel").on("click",function(){
                $("#jyrs").dialog("close");
            });
            $("#zwlr_cancel").on("click",function(){
                $("#jyrs").dialog("close");
            });
        }

        return{
            show:_show
        }
    });
